/*
 * @Author       : Zou Kai
 * @Date         : 2024-11-12 14:15:56
 * @Last Modified by: Your Name
 * @Last Modified time: 
 * @Description  : 
 */
#ifndef COMMON_H
#define COMMON_H

#include<Eigen/Core>
#include "yaml-cpp/yaml.h"
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include<opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>

struct ProjectorConfig
{
    cv::Mat camera_matrix_;
    cv::Mat  distortion_matrix_;
    Eigen::Matrix3d K_matrix_;
    Eigen::Matrix4d T_cam_to_lidar_ ;
    int project_model_;
    float cerr_loss_ = 0.16;
    std::vector<int> resolution_;
    std::vector<Eigen::Vector3d> pixel_grid;
};




Eigen::Matrix4d toTransfromMatrix(const Eigen::Quaterniond &r_quaternion,
                                  const Eigen::Vector3d &t_vec); 

bool vec2D2Mat(const std::vector<std::vector<double>>& vec,cv::Mat& matrix);
bool vec1D2Mat(const std::vector<double>& vec,cv::Mat& matrix,
            int direction);

// bool LoadIntrinsic(const std::string filename, std::vector<std::vector<double>>& K_vec ,
//                  std::vector<double>& D_vec);
// bool LoadExtrinsic(const std::string filename, const std::string camera_name,
//                     Eigen::Matrix4d& transform_extrinsic);

// bool squareProject(const Eigen::Vector3d& center_point,const float cerr_loss,
//             const cv::Mat& camera_matrix,const cv::Mat& distortion_matrix,
//             std::vector<cv::Point2d>& square_vec);

#endif // COMMON_H